package com.yy.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

/**
 * 数据库初始化
 * 
 * @author liyuye
 * @date 2015-5-18 上午10:32:21
 */
public class DBHelper extends SQLiteOpenHelper {
	private Context ctx;

	private static final String DATABASE_NAME = "dota2.db";

	private static final int DATABASE_VERSION = 1;

	private static final String HEROS = "CREATE TABLE HEROS ("
			+ "HERO_ID  TEXT NOT NULL," + "HERO_NAME  TEXT NOT NULL,"
			+ "HERO_YW  TEXT," + "H_IMAGE  Integer," + "H_TYPE  TEXT,"
			+ "H_POSITION  TEXT," + "H_ATTACKTTYPE  TEXT," + "H_CAMP  TEXT,"
			+ "H_JC TEXT,"
			+ "CREATE_DATE  TIMESTAMP DEFAULT (datetime('now', 'localtime'))"
			+ ");";

	public DBHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
		this.ctx = context;
	}

	public DBHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(HEROS);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
		
	}

}
